<?php


$sql_rk="select * from $tb_rk where `isdel`='0'  ORDER BY tdate DESC";
$cn_rk=mysql_db_query($db_name,$sql_rk);
$row_rk = mysql_fetch_row($cn_rk); 

//计算月累计



$danmoth=date("Ym");

$dan_sql="SELECT  sum(yssr) as danyssr,sum(fsjzx) as danfsjzx,sum(fsd) as fsd 
FROM  $tb_rk 
WHERE date_format( tdate,  '%Y%m'  )  =  '".$danmoth."' and `isdel`='0' ";
//200802


$dan_conn=mysql_db_query($db_name,$dan_sql);
$dan_row = mysql_fetch_row($dan_conn); 

//计算月增幅

/*
$yymoth=date("m")-1;
if($yymoth<10) $yymoth="0".$yymoth;
$shangmoth=date("Y").$yymoth;

$shang_sql="SELECT  sum(yssr) as shangyssr,sum(fsjzx) as shangfsjzx,sum(ddjzx) as shangddjzx 
FROM  $tb_rk 
WHERE date_format( tdate,  '%Y%m'  )  =  '".$shangmoth."' and `isdel`='0' ";



$shang_conn=mysql_db_query($db_name,$shang_sql);
$shang_row = mysql_fetch_row($shang_conn); 

if($dan_row[0]!=0){
$moth_yssr=round(($dan_row[0]-$shang_row[0]+0)/$dan_row[0],1);
}else
{
	$moth_yssr=0;
}
if($dan_row[1]!=0){
$moth_fsx=round(($dan_row[1]-$shang_row[1])/$dan_row[1],1);
}else
{
	$moth_fsx=0;
}
if($dan_row[2]!=0){
$moth_ddx=round(($dan_row[2]-$shang_row[2])/$dan_row[2],1);
}else
{
	$moth_ddx=0;
}

*/


//计算年累计


$danyear=date("Y");

$danyear_sql="SELECT  sum(yssr) as danyssr,sum(fsjzx) as danfsjzx,sum(fsd) as danfsd 
FROM  $tb_rk 
WHERE date_format( tdate,  '%Y'  )  =  '".$danyear."' and `isdel`='0' ";



$danyear_conn=mysql_db_query($db_name,$danyear_sql);
$danyear_row = mysql_fetch_row($danyear_conn); 

//计算年增幅


/*$shangyear=date("Y")-1;


$shangyear_sql="SELECT  sum(yssr) as shangyssr,sum(fsjzx) as shangfsjzx,sum(ddjzx) as shangddjzx 
FROM  $tb_rk 
WHERE date_format( tdate,  '%Y'  )  =  '".$shangyear."' and `isdel`='0' ";



$shangyear_conn=mysql_db_query($db_name,$shangyear_sql);
$shangyear_row = mysql_fetch_row($shangyear_conn); 

//当年的运输收入
if($danyear_row[0]!=0){
$mothyear_yssr=round(($danyear_row[0]-$shangyear_row[0])/$danyear_row[0],1);
}else
{
	$mothyear_yssr=0;
}

if($danyear_row[1]!=0){
$mothyear_fsx=round(($danyear_row[1]-$shangyear_row[1])/$danyear_row[1],1);
}else
{
	$mothyear_fsx=0;
}

if($danyear_row[2]!=0){
$mothyear_ddx=round(($danyear_row[2]-$shangyear_row[2])/$danyear_row[2],1);
}else
{
	$mothyear_ddx=0;
}

*/

//进度计算

//发送箱进度＝年累计/年度总任务

//年度总任务

$sql_dj="select * from $tb_dj where `id`='1'";
$cn_dj=mysql_db_query($db_name,$sql_dj);
$row_dj = mysql_fetch_row($cn_dj); 

$ztask=$row_dj[1];

if($ztask!=0){
$dyr=$danyear_row[1]/10000;
$yearjd_fsx=round($dyr/$ztask,2);
}else
{
	$yearjd_fsx=0;
}



?>
<link href="../images/bj.css" rel="stylesheet" type="text/css">

<table width="330" height="235" border="0" class="dttext">
  <tr>
    <td height="25" colspan="4" align="center" class="dantiaobg">集装箱运输指标</td>
  </tr>
  <tr>
    <td height="5" colspan="4" align="center"  bgcolor="#eceee3"></td>
  </tr>
  <tr>
    <td  height="25" colspan="4" align="center" bgcolor="#eceee3"><a href="scrkshow.php?title=<?php echo liandate($row_rk[1]) ?>&type=rili " title='内容提示：<?php echo cdate($row_rk[1]) ?>月度详细资料表 ' target='_blank'"><?php echo chdate($row_rk[1])."   任务进度表";?></a></td>
  </tr>
  <tr>
    <td height="5" colspan="4" align="center"  bgcolor="#eceee3"></td>
  </tr>
  <tr bgcolor="#e3e3e3">
    <td width="58" align="center">单位</td>
    <td width="78" align="center">发送箱(TEU)</td>
    <td width="82" align="center">发送吨(万吨)</td>
    <td width="94" align="center">运输收入(万元)</td>
  </tr>
  <tr>
    <td align="center" bgcolor="#eceee3">当日</td>
    <td align="center" valign="middle" bgcolor="#eceee3"><?php echo round(($row_rk[4]+0),1); ?></td>
    <td align="center" valign="middle" bgcolor="#eceee3"><?php echo round(($row_rk[10]/10000+0),1); ?></td>
    <td align="center" valign="middle" bgcolor="#eceee3"><?php echo round(($row_rk[3]+0),1); ?></td>
  </tr>
  <tr bgcolor="#e3e3e3">
    <td align="center">月累计</td>
    <td align="center" valign="middle"><?php echo round(($dan_row[1]+0),0); ?></td>
    <td align="center" valign="middle"><?php echo round(($dan_row[2]+0)/10000,0); ?></td>
    <td align="center" valign="middle"><?php echo round($dan_row[0]+0,0); ?></td>
  </tr>
 <tr bgcolor="#e3e3e3">
    <td align="center">年累计</td>
    <td align="center" valign="middle"><?php echo round($danyear_row[1]+0,0) ?></td>
    <td align="center" valign="middle"><?php echo  round(($danyear_row[2]/10000+0),0) ?></td>
    <td align="center" valign="middle"><?php echo round(($danyear_row[0]+0),2) ?></td>
  </tr>
</table>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>